/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2013
 */

package com.bbs.bean;

import javacommon.base.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


@Entity
@Table(name = "bbs_user_info")
public class BbsUserInfo extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "BbsUserInfo";
	public static final String ALIAS_USERID = "用户id";
	public static final String ALIAS_USERNAME = "用户名";
	public static final String ALIAS_PASSWORD = "用户密码";
	public static final String ALIAS_EMAIL = "用户Email";
	public static final String ALIAS_USER_LEVEL = "用户级别";
	public static final String ALIAS_USER_INTERGRAL = "用户积分";
	public static final String ALIAS_USER_STATE = "用户状态";
	public static final String ALIAS_USER_IMAGE = "用户头像";
	public static final String ALIAS_USER_SEX = "用户性别";
	public static final String ALIAS_USER_REGISTER_TIME = "注册时间";
	
	//date formats
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 用户id       db_column: userid 
     */ 	
	
	private java.lang.Integer userid;
    /**
     * 用户名       db_column: username 
     */ 	
	@NotBlank @Length(max=50)
	private java.lang.String username;
    /**
     * 用户密码       db_column: password 
     */ 	
	@NotBlank @Length(max=100)
	private java.lang.String password;
    /**
     * 用户Email       db_column: email 
     */ 	
	@Email @Length(max=50)
	private java.lang.String email;
    /**
     * 用户级别       db_column: user_level 
     */ 	
	@NotNull 
	private java.lang.Integer userLevel;
    /**
     * 用户积分       db_column: user_intergral 
     */ 	
	@NotNull 
	private java.lang.Integer userIntergral;
    /**
     * 用户状态       db_column: user_state 
     */ 	
	@NotNull 
	private java.lang.Integer userState;
    /**
     * 用户头像       db_column: user_image 
     */ 	
	@Length(max=50)
	private java.lang.String userImage;
    /**
     * 用户性别       db_column: user_sex 
     */ 	
	
	private java.lang.Integer userSex;
    /**
     * 注册时间       db_column: user_register_time 
     */ 	
	@Length(max=20)
	private java.lang.String userRegisterTime;
	//columns END


	public BbsUserInfo(){
	}

	public BbsUserInfo(
		java.lang.Integer userid
	){
		this.userid = userid;
	}

	

	public void setUserid(java.lang.Integer value) {
		this.userid = value;
	}
	
	@Id @GeneratedValue(generator="custom-id")
	@GenericGenerator(name="custom-id", strategy = "increment")
	@Column(name = "userid", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getUserid() {
		return this.userid;
	}
	
	@Column(name = "username", unique = false, nullable = false, insertable = true, updatable = true, length = 50)
	public java.lang.String getUsername() {
		return this.username;
	}
	
	public void setUsername(java.lang.String value) {
		this.username = value;
	}
	
	@Column(name = "password", unique = false, nullable = false, insertable = true, updatable = true, length = 100)
	public java.lang.String getPassword() {
		return this.password;
	}
	
	public void setPassword(java.lang.String value) {
		this.password = value;
	}
	
	@Column(name = "email", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
	public java.lang.String getEmail() {
		return this.email;
	}
	
	public void setEmail(java.lang.String value) {
		this.email = value;
	}
	
	@Column(name = "user_level", unique = false, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getUserLevel() {
		return this.userLevel;
	}
	
	public void setUserLevel(java.lang.Integer value) {
		this.userLevel = value;
	}
	
	@Column(name = "user_intergral", unique = false, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getUserIntergral() {
		return this.userIntergral;
	}
	
	public void setUserIntergral(java.lang.Integer value) {
		this.userIntergral = value;
	}
	
	@Column(name = "user_state", unique = false, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getUserState() {
		return this.userState;
	}
	
	public void setUserState(java.lang.Integer value) {
		this.userState = value;
	}
	
	@Column(name = "user_image", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
	public java.lang.String getUserImage() {
		return this.userImage;
	}
	
	public void setUserImage(java.lang.String value) {
		this.userImage = value;
	}
	
	@Column(name = "user_sex", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getUserSex() {
		return this.userSex;
	}
	
	public void setUserSex(java.lang.Integer value) {
		this.userSex = value;
	}
	
	@Column(name = "user_register_time", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
	public java.lang.String getUserRegisterTime() {
		return this.userRegisterTime;
	}
	
	public void setUserRegisterTime(java.lang.String value) {
		this.userRegisterTime = value;
	}
	

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Userid",getUserid())
			.append("Username",getUsername())
			.append("Password",getPassword())
			.append("Email",getEmail())
			.append("UserLevel",getUserLevel())
			.append("UserIntergral",getUserIntergral())
			.append("UserState",getUserState())
			.append("UserImage",getUserImage())
			.append("UserSex",getUserSex())
			.append("UserRegisterTime",getUserRegisterTime())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getUserid())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof BbsUserInfo == false) return false;
		if(this == obj) return true;
		BbsUserInfo other = (BbsUserInfo)obj;
		return new EqualsBuilder()
			.append(getUserid(),other.getUserid())
			.isEquals();
	}
}

